/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../custom.less';
@import './vars.less';

@collapse-item-prefix-cls: ~'@{css-prefix}collapse-item';

.@{collapse-item-prefix-cls} {
  .component-css-vars-collapse-item();

  margin-top: var(--ti-collapse-item-margin-top);
  background-color: var(--ti-collapse-item-bg-color);
  border: 1px solid var(--ti-collapse-item-border-color);
  border-radius: var(--ti-collapse-item-border-radius);

  &:last-child {
    margin-bottom: -1px;
  }

  &.is-disabled &__header {
    color: var(--ti-collapse-item-disabled-text-color);
    cursor: not-allowed;
  }

  &.is-disabled &__arrow {
    fill: var(--ti-collapse-item-disabled-text-color);
  }

  &__header {
    display: flex;
    align-items: center;
    height: 34px;
    line-height: 34px;
    background-color: var(--ti-collapse-item-header-bg-color);
    color: var(--ti-collapse-item-text-color);
    font-size: var(--ti-collapse-item-header-font-size);
    font-family: Helvetica, Arial, 'microsoft yahei';
    outline: 0;
    cursor: pointer;
    transition: border-bottom-color 0.3s;
    border-radius: var(--ti-common-border-radius-normal);
    padding: var(--ti-collapse-item-header-padding-vertical) var(--ti-collapse-item-header-padding-horizontal);

    &.focusing:focus:not(:hover) {
      color: var(--ti-collapse-item-header-focus-text-color);
    }

    &.is-active {
      border-bottom-color: transparent;
    }

    svg {
      font-size: var(--ti-collapse-item-icon-font-size);
      fill: var(--ti-collapse-item-icon-color);
    }
  }

  &__arrow {
    font-size: var(--ti-collapse-item-arrow-font-size);
    margin-right: 12px;
    order: -1;
    transition: transform 0.3s;
    transform: rotate(90deg);

    &.is-active {
      transform: rotate(-90deg);
    }

    &:hover,
    &.is-active {
      fill: var(--ti-collapse-item-arrow-hover-text-color);
    }
  }

  &__wrap {
    will-change: height;
    background-color: var(--ti-collapse-item-wrap-bg-color);
    overflow: hidden;
    box-sizing: border-box;
  }

  &__content {
    padding: 12px 16px;
    font-size: var(--ti-collapse-item-content-font-size);
    color: var(--ti-collapse-item-text-color);
    border-top: 1px solid var(--ti-collapse-item-content-border-color-top);
    line-height: 1.769230769230769;
  }
}
